<?php defined('InShopNC') or exit('Access Invalid!');?>
<div class="ncm-container">
<?php include template('member/member_left');?>
  <div class="right-layout">
<div class="ncm-flow-layout">
  <div class="ncm-flow-container">
    <div class="title">
      <h3>退货退款服务</h3>
    </div><div class="alert">
      <h4>提示：</h4>
      <ul>
        <li>1. 若提出申请后，商家拒绝退款或退货，可再次提交申请或选择<em>“商品投诉”</em>，请求商城客服人员介入。</li>
        <li>2. 成功完成退款/退货；经过商城审核后，会将退款金额以<em>“预存款”</em>的形式返还到您的余额账户中。</li>
      </ul>
    </div>
    <div id="saleRefundReturn" show_id="1">
      <div class="ncm-flow-step">
        <dl class="step-first current">
          <dt>买家申请退货</dt>
          <dd class="bg"></dd>
        </dl>
        <dl class="<?php if ($output['return']['seller_state'] == 2) { ?>current<?php } ?>">
          <dt>商家处理退货申请</dt>
          <dd class="bg"> </dd>
        </dl>
        <dl class="<?php if ($output['return']['express_id'] > 0 && !empty($output['return']['invoice_no'])) { ?>current<?php } ?>">
          <dt>买家退货给商家</dt>
          <dd class="bg"> </dd>
        </dl>
        <dl class="<?php if ($output['refund']['refund_state'] == 3) { ?>current<?php } ?>">
          <dt>确认收货，平台审核</dt>
          <dd class="bg"> </dd>
        </dl>
      </div>
      <div class=" ncm-default-form">
        <h3>我的退货退款申请</h3>
        <dl>
          <dt>退货退款编号：</dt>
          <dd><?php echo $output['return']['refund_sn']; ?></dd>
        </dl>
        <dl>
          <dt><?php echo $lang['return_order_add_time'].$lang['nc_colon'];?></dt>
          <dd><?php echo date("Y-m-d H:i:s",$output['return']['add_time']);?></dd>
        </dl>
		<dl>
		  <dt><?php echo '商品名称'.$lang['nc_colon'];?></dt>
		  <dd><?php echo $output['return']['goods_name']; ?></dd>
		</dl>
        <dl>
          <dt><?php echo $lang['refund_order_refund'].$lang['nc_colon'];?></dt>
          <dd><?php echo $lang['currency'];?><?php echo $output['return']['refund_amount']; ?></dd>
        </dl>
        <dl>
          <dt><?php echo $lang['return_order_return'].$lang['nc_colon'];?></dt>
          <dd><?php echo $output['return']['return_type']==2 ? $output['return']['goods_num']:'无'; ?></dd>
        </dl>
        <dl>
          <dt>退货退款说明：</dt>
          <dd><?php echo $output['return']['buyer_message']; ?></dd>
        </dl>
		<?php if ($output['return']['express_id'] > 0 && !empty($output['return']['invoice_no'])) { ?>
		<dl>
		  <dt><?php echo '物流信息'.$lang['nc_colon'];?></dt>
		  <dd> <?php echo $output['e_name'].' , '.$output['return']['invoice_no']; ?> </dd>
		</dl>
		<?php } ?>
        <h3>商家退货退款处理</h3>
        <dl>
          <dt><?php echo $lang['return_state'].$lang['nc_colon'];?></dt>
          <dd><?php echo $output['state_array'][$output['return']['seller_state']]; ?></dd>
        </dl>
		<?php if ($output['return']['seller_time'] > 0) { ?>
		<dl>
		  <dt><?php echo $lang['return_seller_message'].$lang['nc_colon'];?></dt>
		  <dd> <?php echo $output['return']['seller_message']; ?> </dd>
		</dl>
		<?php } ?>

<?php if ($output['return']['seller_state'] == 2 && $output['return']['refund_state'] >= 2) { ?>
<h3>商城退款审核</h3>
  <dl>
    <dt><?php echo '平台确认'.$lang['nc_colon'];?></dt>
    <dd><?php echo $output['admin_array'][$output['return']['refund_state']]; ?></dd>
  </dl>
  <?php } ?>
  <?php if ($output['return']['admin_time'] > 0) { ?>
  <dl>
    <dt><?php echo '平台备注'.$lang['nc_colon'];?></dt>
    <dd> <?php echo $output['return']['admin_message']; ?> </dd>
  </dl>
  <?php } ?>
<?php if($output['return']['seller_state'] == 2 && $output['return']['return_type']==2 && $output['return']['express_id'] = 0 && empty($output['return']['invoice_no'])) { ?>

  <form id="post_form" method="post" action="index.php?act=member_return&op=ship&return_id=<?php echo $output['return']['refund_id']; ?>">
    <input type="hidden" name="form_submit" value="ok" />
  <h3>请填写退货发货信息</h3>
    <dl>
      <dt><?php echo '物流公司'.$lang['nc_colon'];?></dt>
      <dd>
      	<select name="express_id">
      		<option value="0">-请选择-</option>
      	<?php if(!empty($output['express_list']) && is_array($output['express_list'])){?>
      	<?php foreach($output['express_list'] as $key=> $val){?>
      		<option value="<?php echo $val['id']; ?>"><?php echo $val['e_name']; ?></option>
      	<?php } ?>
      	<?php } ?>
      	</select>
      	</dd>
    </dl>
    <dl>
      <dt><i class="required">*</i><?php echo '物流单号'.$lang['nc_colon'];?></dt>
      <dd>
        <input type="text" class="text w150" name="invoice_no" value="" />
        <p class="hint">发货 <?php echo $output['return_delay'];?> 天后，当卖家选择未收到则要进行延迟时间操作；
            如果超过 <?php echo $output['return_confirm'];?> 天不处理按弃货处理，直接由管理员确认退款。</p>
      </dd>
    </dl>
  <div class="bottom">
    <label class="submit-border">
      <input type="submit" class="submit" id="confirm_button" value="<?php echo $lang['nc_ok'];?>" />
    </label>
      <a href="javascript:history.go(-1);" class="ncm-btn ml10"><i class="icon-reply"></i>返回列表</a>
  </div>

  </form>
<script type="text/javascript">
$(function(){
    $('#post_form').validate({
        errorLabelContainer: $('#warning'),
        invalidHandler: function(form, validator) {
               $('#warning').show();
        },
		submitHandler:function(form){
			ajaxpost('post_form', '', '', 'onerror')
		},
        rules : {
            invoice_no : {
                required   : true
            }
        },
        messages : {
            invoice_no  : {
                required   : '请填写物流单号'
            }
        }
    });
});
</script>
<?php } else { ?>
        <div class="bottom"><a href="javascript:history.go(-1);" class="ncm-btn"><i class="icon-reply"></i>返回列表</a></div>
<?php } ?>
              </div>
    </div>
  </div>

  </div>
  <div class="clear"></div>
</div>